#CC=g++ -pg -g
CC=g++ -Wall -D DEBUG
CFLAGS=-O3 -funroll-loops -c
LDFLAGS=-O2 -lm
SOURCES=Bfs.cc Bot.cc Bug.cc Map.cc MyBot.cc Order.cc State.cc MI5.cc Strategy.cc Torus.cc
HEADERS=Bfs.hh Bot.h Bug.h group_by.hh Map.hh Order.hh Square.hh State.h MI5.hh Strategy.hh Timer.h Torus.hh
SUBMIT=Makefile ${SOURCES} ${HEADERS}
OBJECTS=$(SOURCES:.cc=.o)
EXECUTABLE=MyBot
TESTS=Torus_ut

#Uncomment the following to enable debugging
#CFLAGS+=-g -DDEBUG

all: $(OBJECTS) $(EXECUTABLE) tests

tests: Torus_ut

$(EXECUTABLE): $(OBJECTS)
	$(CC) $(LDFLAGS) $(OBJECTS) -o $@

Torus_ut: Torus_ut.cc Bug.o Torus.o Map.o
	$(CC) $(LDFLAGS) $^ -o $@

.cc.o:
	$(CC) $(CFLAGS) $< -o $@

%: %.cc $(OBJECTS)
	$(CC) $(LDLAGS) $< -o $@

clean: 
	-rm -f ${EXECUTABLE} ${OBJECTS} *.d
	-rm -f debug.txt
	-rm -f *.o
	-rm -f *~
	-rm -f debug_*.txt
	-rm -f ${TESTS}


zip: clean
	-rm -f *.zip
	zip search_and_destroy.zip 



.PHONY: all clean zip


